import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询产品列表
export function listProd(query) {
  return request({
    url: '/system/prod/list',
    method: 'get',
    params: query
  })
}

// 查询分类下拉树结构
export function cateTreeSelect(query) {
  return request({
    url: '/system/prod/cateTree',
    method: 'get',
    params: query
  })
}

// 产品状态修改
export function changeProdStatus(prodId, status) {
  const data = {
    prodId,
    status
  }
  return request({
    url: '/system/prod/changeStatus',
    method: 'put',
    data: data
  })
}

// 查询产品详细
export function getProd(prodId) {
  return request({
    url: '/system/prod/' + parseStrEmpty(prodId),
    method: 'get'
  })
}

// 新增产品
export function addProd(data) {
  return request({
    url: '/system/prod',
    method: 'post',
    data: data
  })
}

// 修改产品
export function updateProd(data) {
  return request({
    url: '/system/prod',
    method: 'put',
    data: data
  })
}

// 删除产品
export function delProd(prodId) {
  return request({
    url: '/system/prod/' + prodId,
    method: 'delete'
  })
}
